const paletteNodeTemplate = function($, go, opt) {
  return $(go.Node, 'Vertical', {}, $(go.Panel, 'Auto',
        $(go.Shape, 'Circle', {
          minSize: new go.Size(40, 40), fill: opt.bgColor, strokeWidth: 0
        }),
        $(go.TextBlock, 'start', {
          font: 'bold 11pt Helvetica, Arial, sans-serif',
          stroke: 'whitesmoke'
        }, new go.Binding('text')
      )
    )
  )
}

export const palettePersonTemplate = function($, go) {
  return paletteNodeTemplate($, go, {bgColor: '#79C900'})
}
export const paletteCarTemplate = function($, go) {
  return paletteNodeTemplate($, go, {bgColor: 'red'})
}

export const diagramPersonTemplate = function($, go, contextMenu) {
  return $(go.Node, 'Spot', {
    selectionAdorned: false,
    scale: 2,
    contextMenu: contextMenu
  },
  $(go.Shape, 'Circle', { width: 30, height: 30, strokeWidth: 0, fill: 'skyblue' }),
    $(go.Panel, 'Spot', {isClipping: true},
      $(go.Shape, 'Circle', {
        width: 28,
        strokeWidth: 0
      }),
      $(go.Picture, {
        maxSize: new go.Size(28, 28),
        background: 'transparent',
        source: require('../../assets/img/default_person.jpg')
      })
    )
  )
}

export const diagramCarTemplate = function($, go) {
  return $(go.Node, 'Spot', {
    selectionAdorned: false,
    scale: 2
  },
  $(go.Shape, 'Circle', { width: 30, height: 30, strokeWidth: 0, fill: 'skyblue' }),
    $(go.Panel, 'Spot', {isClipping: true},
      $(go.Shape, 'Circle', {
        width: 28,
        strokeWidth: 0
      }),
      $(go.Picture, {
        maxSize: new go.Size(28, 28),
        background: 'transparent',
        source: require('../../assets/img/default-car.jpg')
      })
    )
  )
}